<template>
    <el-date-picker class="search-date-picker"
        v-model="option.value"
        :type="option.dateType || 'date'"
        size="small"
        :picker-options="option.pickerOptions || {}"
        :format="option.format || 'yyyy-MM-dd'"
        :value-format="option.valueFormat"
        :range-separator="option.rangeSeparator"
        :start-placeholder="option.startPlaceholder"
        :end-placeholder="option.endPlaceholder"
        :default-time="option.defaultTime"
        :clearable="false"
        :unlink-panels="option.unlinkPanels"
        :popper-class="option.popperClass"
        @blur="blurSearchItem(option, index)"
        @change="changeDateSearchItem">
    </el-date-picker>
</template>

<script>
import normalMixin from "../mixin/normalMixin";
export default {
    name: "searchDate",
    mixins: [normalMixin],
    methods: {
        /**
         * Date 组件change事件触发的事件
         * @param {(String|String[])} value date组件返回数据
         */
        changeDateSearchItem(value) {
            if (this.option.changeMethod) this.option.changeMethod(value);
        }
    }
}
</script>
